package com.chenju.invokechainservice.service;

import com.chenju.invokechainservice.common.enums.ChangeType;
import com.chenju.invokechainservice.common.exceptions.FunnyException;
import com.chenju.invokechainservice.domain.DiffMethodDetailEntity;
import com.chenju.invokechainservice.domain.DiffMethodEntity;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.Modifier;
import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.body.MethodDeclaration;
import com.github.javaparser.ast.body.Parameter;
import com.github.javaparser.ast.expr.AnnotationExpr;
import com.github.javaparser.ast.type.ReferenceType;
import com.github.javaparser.symbolsolver.JavaSymbolSolver;

import java.util.List;
import java.util.Map;

public interface JavaParserService {
    CompilationUnit javaParser(String filePath, JavaSymbolSolver symbolSolver);

    List<DiffMethodEntity> compareCompilationUnit(String rootPath, Map<String, ChangeType> fileChangeTypeMap);

    List<DiffMethodEntity> parseProjectDiffMethod(String rootPath);

    List<DiffMethodEntity> compareMethod(CompilationUnit oldCu, CompilationUnit newCu);

    DiffMethodDetailEntity compareMethodDiffDetail(MethodDeclaration oldMethod, MethodDeclaration newMethod);

    List<String> findStringAnnotations(NodeList<AnnotationExpr> annotationExprs);
    List<String> findStringModifiers(NodeList<Modifier> modifiers);
    List<String> findStringParameters(NodeList<Parameter> parameters);
    List<String> findStringThrowExceptions(NodeList<ReferenceType> throwExceptions);

    JavaSymbolSolver setJavaSymbolSolver(String rootPath, String release);
}
